﻿#include "AchievementPart.h"
#include "Player.h"
#include "PlayerMgr.h"
#include "Common/TableData/AchievementAchievementCfg.h"
#include "Common/TableData/AchievementAchievementrewardCfg.h"
#include "base/core/Profiler.h"
using namespace ProtoBuf;

AchievementPart::AchievementPart()
{
	//初始化成就大类
	for (uint32_t i = 0; i < ACHIEVEMENT_TYPE_NUM; ++i)
	{
		AchievementPlayerSortInfo achievementPlayerSortInfo;
		achievementPlayerSortInfo.sortType = i;
		_achievementMap.push_back(achievementPlayerSortInfo);
	}
}

AchievementPart::~AchievementPart()
{
}

bool AchievementPart::SaveDB(CharacterDBInfo& characterDB)
{
	CharacterAchievementDBData* pAchievementData = characterDB.mutable_achievementdata();
	if (nullptr != pAchievementData)
	{
		for (uint32_t i = ACHIEVEMENT_TYPE_PERSION; i < _achievementMap.size(); i++)
		{
			GroupAchievementDBData* pGroupAchievementData = pAchievementData->add_groupachievementdata();
			if (nullptr != pGroupAchievementData)
			{
				for (std::map<uint32_t, AchievementInfo>::iterator iter = _achievementMap[i].achievementList.begin();
					iter != _achievementMap[i].achievementList.end(); ++iter)
				{
					SingleAchievementDBData* pSingleAchievementData = pGroupAchievementData->add_achievementinfolist();
					if (nullptr != pSingleAchievementData)
					{
						pSingleAchievementData->set_id(iter->first);
						pSingleAchievementData->set_completecount(iter->second.completeCount);
						pSingleAchievementData->set_status(iter->second.status);
					}
				}
				pGroupAchievementData->set_sorttype(i);
				pGroupAchievementData->set_achievementreward(_achievementMap[i].achievementReward);
			}			
		}
	}
	
	return true;
}

bool AchievementPart::Init(Creature *pMaster, uint32_t partType, CharacterDBInfo* pCharacterDB /* = nullptr */)
{
	Part::Init(pMaster, partType);

	const CharacterAchievementDBData& achievementData = pCharacterDB->achievementdata();
	for (int32_t i = 0; i < achievementData.groupachievementdata_size(); i++)
	{
		const GroupAchievementDBData& gourpAchievementData = achievementData.groupachievementdata(i);
		int32_t sortType = gourpAchievementData.sorttype();
		if (sortType < ACHIEVEMENT_TYPE_PERSION || sortType >= ACHIEVEMENT_TYPE_NUM)
		{
			//LogErrFmtPrint("[logic] AchievementPart::Init sortType error ....sortType:%d ", sortType);
			continue;
		}

		uint32_t totalPointValue = 0;
		for (int32_t j = 0; j < gourpAchievementData.achievementinfolist_size(); j++)
		{
			const SingleAchievementDBData& singleAchievementData = gourpAchievementData.achievementinfolist(j);
			uint32_t achievementId = singleAchievementData.id();
			AchievementInfo achievementInfo;
			achievementInfo.completeCount = singleAchievementData.completecount();
			achievementInfo.status = singleAchievementData.status();
			_achievementMap[sortType].achievementList[achievementId] = achievementInfo;

			if (achievementInfo.status == ACHIEVEMENT_STATUS_REWARD)
			{
				const AchievementAchievementCfgInfo* pAchievementCfgInfo = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(achievementId);
				if (nullptr != pAchievementCfgInfo)
				{
					totalPointValue += pAchievementCfgInfo->achievementPoint;
				}
			}
		}
		_achievementMap[sortType].sortType = sortType;
		_achievementMap[sortType].achievementReward = gourpAchievementData.achievementreward();

		if (totalPointValue > 0)
		{
			LogicToCenterRankingListAchievement req;
			req.set_charid(m_pMaster->GetCid());
			AchievementPointInfo* pointInfo = req.mutable_changeachievement();
			pointInfo->set_type(sortType);
			pointInfo->set_point(totalPointValue);
			g_GetLogicService()->SendDataToCenter(EMODULE_ID_RANKINGLIST, LOGIC_CENTER_UPDATe_RANKING_LIST_ACHIEVEMENT, &req);
		}
	}

	/*if (0 == pCharacterDB->basedata().logouttime())
	{
		//第一次登陆
		FirstLogin();
	}*/
	//订阅事件
	g_GetEvent()->Subscribe(this, EVENT_CREATURE_DEAD, m_pMaster->GetCid(), CREATURE_PLAYER, "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_CREATURE_DEAD, m_pMaster->GetCid(), CREATURE_MONSTER, "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_LEVELUP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_PASS_DUPLICATE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ADD_TITLE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ADD_FRIEND, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_FRIEND_GIFT, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ARENA_LEVEL_UP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ARENA_RESULT, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ARENA_JOIN, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_FINISH_TASK, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_TREASURE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_CHAT, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ITEM_CHANGE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_EQUIP_REFINE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_EQUIP_REFINE_ALL, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_EQUIP_RECAST, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_COMPOSE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_STONE_INLAY, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_CAMP_CHANGE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_ANGER_CHANGE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_GOD_LEVEL, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_MONEY_CHANGE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_FASHION_ACTIVE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_HORSE_ACTIVE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart"); 
	g_GetEvent()->Subscribe(this, EVENT_FINISH_RISK, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart"); 
	g_GetEvent()->Subscribe(this, EVENT_EQUIP_DRESS, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart"); 
	g_GetEvent()->Subscribe(this, EVENT_UNION_RUN_BUSINESS, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	g_GetEvent()->Subscribe(this, EVENT_UNION_HISTORY_CONTRI, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_ACTIVIYT_PASS, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_UNION_BIAOCHE_FINISH, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart"); 
	//g_GetEvent()->Subscribe(this, EVENT_SIGN_UP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_ADD_ATT_POINT, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_SKILL_UP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_ARENA_SCORE_CHANGE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_CAMP_ELECTION, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_CAMP_PRAYER, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_EQUP_STREN, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_EQUP_STREN_ALL, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_DEPUTY_COLLECT_LEVEL_UP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_DEPUTY_FORGE_LEVEL_UP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_DEPUTY_FORGE_EQUIP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_ADD_PET, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_PET_FIGHT_POWER_CHANGE, m_pMaster->GetCid(), CREATURE_PET, "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_PET_FEED, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_PET_SKILL_UP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_PET_UPGRADE_STAR, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	//g_GetEvent()->Subscribe(this, EVENT_XINGZUO_TP, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart"); 
	//g_GetEvent()->Subscribe(this, EVENT_UNION_FIGHT_UPGRADE, m_pMaster->GetCid(), m_pMaster->CreatureKind(), "AchievementPart");
	return true;
}

bool AchievementPart::UnInit()
{
	g_GetEvent()->UnSubscribeAll(this);
	_achievementMap.clear();
	return true;
}

void AchievementPart::OnExecute(uint16_t nEventID, uint64_t nSrcID, uint8_t bySrcType, void *pContext, int32_t nLen)
{
	switch (nEventID)
	{
	case EVENT_CREATURE_DEAD:
	{
		if ((uint32_t)nLen >= sizeof(DieEvent))
		{
			DieEvent *pDieEvent = (DieEvent*)pContext;
			if (nullptr == pDieEvent)	return;
			Scene *pScene = g_GetSceneMgr()->GetScene(pDieEvent->sceneId);
			if (nullptr == pScene)		return;
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			if (CREATURE_PLAYER == bySrcType)
			{
				/*if (pDieEvent->nCid == m_pMaster->GetCid())
				{
					Creature *pKiller = pScene->GetCreature(pDieEvent->killerCid);
					if (nullptr == pKiller)	return;
					//【1.被怪物杀死2.被玩家杀死】
					if (pKiller->CreatureKind() == CREATURE_MONSTER)
					{
						param.objectId = 1;
					}
					else if (pKiller->CreatureKind() == CREATURE_PLAYER)
					{
						param.objectId = 2;
					}
					param.parameterType = EAEventType_Socail;
					param.parameter = PARAMETER_TYPE_SOCIAL_DEAD;
					param.count = 1;
					UpdateAchievement(param);
				}*/
			}
			else if (CREATURE_MONSTER == bySrcType)
			{
				param.parameterType = EAEventType_KilMon;
				param.parameter = PARAMETER_TYPE_KILL_MONSTER;
				param.count = pDieEvent->count;
				UpdateAchievement(param);

				param.objectId = pDieEvent->monsterId;
				param.parameter = PARAMETER_TYPE_KILL_MONSTERID;
				UpdateAchievement(param);

				if (pDieEvent->nType == 3/*ENUM_MONSTER_TYPE_BOSS_MONSTER boss*/)
				{
					param.parameter = PARAMETER_TYPE_KILL_MONSTERBOSS;
					UpdateAchievement(param);
				}
			}
		}
		break;
	}
	case EVENT_LEVELUP:
	{
		if ((uint32_t)nLen >= sizeof(PlayerLeveUpEvent))
		{
			PlayerLeveUpEvent *pEvent = (PlayerLeveUpEvent*)pContext;
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Property;
			param.parameter = PARAMETER_TYPE_PROPERTY_LEVEL;
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}
	/*case EVENT_ACTIVIYT_PASS:
	{
		if ((uint32_t)nLen >= sizeof(ActivityPassEvent))
		{
			ActivityPassEvent *pActivityPassEvent = (ActivityPassEvent*)pContext;
			if (nullptr == pActivityPassEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Duplicate;
			param.parameter = PARAMETER_TYPE_ACTIVITY_SUCESS;
			param.objectId = pActivityPassEvent->activityId;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_PASS_DUPLICATE:
	{
		if ((uint32_t)nLen >= sizeof(PassDupEvent))
		{
			PassDupEvent *pEvent = (PassDupEvent*)pContext;
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Duplicate;
			param.parameter = PARAMETER_TYPE_DUPLICATE_PASS;
			param.objectId = pEvent->dupId;
			param.count = 1;
			UpdateAchievement(param);

			param.type = Update_Type_Add;
			param.parameter = PARAMETER_TYPE_DUPLICATE_SPECIFICPASS;
			UpdateAchievement(param);

			param.parameterType = EAEventType_Nuolin_Risk;
			param.parameter = PARAMETER_TYPE_RL_RISK_GROUP;
			param.objectId = pEvent->groupId;
			UpdateAchievement(param);

			if (pEvent->isLadder)
			{
				param.type = Update_Type_Total;
				param.parameter = PARAMETER_TYPE_RL_RISK_LADDER;
				param.count = pEvent->layer;
				UpdateAchievement(param);
			}
		}
		break;
	}
	/*case EVENT_UNION_BIAOCHE_FINISH:
	{
		if ((uint32_t)nLen >= sizeof(EscortEvent))
		{
			//EscortEvent *pEvent = (EscortEvent*)pContext;
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_FactionSocial;
			param.parameter = PARAMETER_TYPE_FACTIONSOCIAL_ESCORT;
			param.count = 1;
			//param.objectId = pEvent->type;
			UpdateAchievement(param);
		}
		break;
	}*/
	/*case EVENT_SIGN_UP:
	{
		if ((uint32_t)nLen >= sizeof(SignEvent))
		{
			SignEvent *pEvent = (SignEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			if (pEvent->monthSign)
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_Sign;
				param.parameter = PARAMETER_TYPE_SIGN_TOTAL;
				param.count = 1;
				UpdateAchievement(param);
			}
			else
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Total;
				param.parameterType = EAEventType_Sign;
				param.parameter = PARAMETER_TYPE_SIGN_SERIAL;
				param.count = pEvent->continueCount;
				UpdateAchievement(param);
			}
			
			/ *param.parameter = PARAMETER_TYPE_SIGN_SERIAL;
			if (!pEvent->isContinue)
			{
				//非连续，需要清除之前的连续记录(已完成成就不需要清除)
				ClearAchievement(param);
			}
			UpdateAchievement(param);* /
		}
		break;
	}*/
	case EVENT_ADD_TITLE:
	{
		if ((uint32_t)nLen >= sizeof(AddTitleEvent))
		{
			AddTitleEvent *pEvent = (AddTitleEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Socail;
			param.parameter = PARAMETER_TYPE_SOCIAL_GETTITLE;
			param.count = 1;
			UpdateAchievement(param);

			param.objectId = pEvent->titleID;
			param.parameter = PARAMETER_TYPE_SOCIAL_GETSPECIFICTITLE;
			UpdateAchievement(param);
			
		}
		break;
	}
	/*case EVENT_ADD_ATT_POINT:
	{
		if ((uint32_t)nLen >= sizeof(AddPoingEvent))
		{
			AddPoingEvent *pEvent = (AddPoingEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Player;
			param.parameter = PARAMETER_TYPE_PLAYER_ATTR;
			param.count = pEvent->point;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_SKILL_UP:
	{
		if ((uint32_t)nLen >= sizeof(playerSkillUpEvent))
		{
			playerSkillUpEvent *pEvent = (playerSkillUpEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Player;
			param.parameter = PARAMETER_TYPE_PLAYER_SKILLLEVEL;
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_ADD_FRIEND:
	{
		//playerSkillUpEvent *pEvent = (playerSkillUpEvent*)(pContext);
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_Socail;
		param.parameter = PARAMETER_TYPE_SOCIAL_FRIENDNUMBER;
		param.count = 1;
		UpdateAchievement(param);
		break;
	}
	case EVENT_FRIEND_GIFT:
	{
		if ((uint32_t)nLen >= sizeof(FriendGiftEvent))
		{
			FriendGiftEvent *pEvent = (FriendGiftEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Socail;
			param.parameter = PARAMETER_TYPE_SOCIAL_FRIENDSENDGIFT;
			param.count = pEvent->times;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_ARENA_LEVEL_UP:
	{
		if ((uint32_t)nLen >= sizeof(ArenaLevelUpEvent))
		{
			ArenaLevelUpEvent *pEvent = (ArenaLevelUpEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Dec;
			param.parameterType = EAEventType_Arena;
			param.parameter = PARAMETER_TYPE_ARENA_CRAWL;
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_ARENA_RESULT:
	{
		if ((uint32_t)nLen >= sizeof(ArenaResultEvent))
		{
			ArenaResultEvent *pEvent = (ArenaResultEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Arena;
			param.parameter = pEvent->isWin ? PARAMETER_TYPE_ARENA_SCUESS : PARAMETER_TYPE_ARENA_FAIL;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_ARENA_JOIN:
	{
		if ((uint32_t)nLen >= sizeof(ArenaJoinEvent))
		{
			//ArenaJoinEvent *pEvent = (ArenaJoinEvent*)(pContext);
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Arena;
			param.parameter = PARAMETER_TYPE_ARENA_COMPLETE;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	/*case EVENT_ARENA_SCORE_CHANGE:
	{
		if ((uint32_t)nLen >= sizeof(ArenaScoreEvent))
		{
			ArenaScoreEvent *pEvent = (ArenaScoreEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Arena;
			param.parameter = PARAMETER_TYPE_ARENA_SCORE;
			param.count = pEvent->score;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_FINISH_TASK:
	{
		if ((uint32_t)nLen >= sizeof(FinishTaskEvent))
		{
			FinishTaskEvent *pEvent = (FinishTaskEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Mission;
			param.parameter = PARAMETER_TYPE_MISSION_SUBMIT;
			param.objectId = pEvent->taskId;
			param.count = 1;
			UpdateAchievement(param);

			param.type = Update_Type_Add;
			if (pEvent->taskType == MISSION_TYPE_ID_LOOP)
				param.parameter = PARAMETER_TYPE_MISSION_RINGSUBMIT;
			else if (pEvent->taskType == MISSION_TYPE_ID_CAMP)
				param.parameter = PARAMETER_TYPE_MISSION_CAMPSUBMIT;
			else if (pEvent->taskType == MISSION_TYPE_ID_GUILD)
				param.parameter = PARAMETER_TYPE_MISSION_FAMILYSUBMIT;
			else
				return;
			UpdateAchievement(param);
		}
		break;
	}
	//case EVENT_GUILD_CHANGE:
	/*case EVENT_UNION_FIGHT_UPGRADE:
	{
		if ((uint32_t)nLen >= sizeof(UnionFightUpgrade))
		{
			UnionFightUpgrade *pEvent = (UnionFightUpgrade*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_FactionSocial;
			param.parameter = PARAMETER_TYPE_FACTIONSOCIAL_PRACTICE;
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_TREASURE:
	{
		if ((uint32_t)nLen >= sizeof(TreasureEvent))
		{
			//TreasureEvent *pEvent = (TreasureEvent*)(pContext);
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Nuolin_Risk;
			param.parameter = PARAMETER_TYPE_RL_RISK_WB;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_CHAT:
	{
		if ((uint32_t)nLen >= sizeof(ChatWorldEvent))
		{
			//ChatWorldEvent *pEvent = (ChatWorldEvent*)(pContext);
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Socail;
			param.parameter = PARAMETER_TYPE_SOCIAL_WORLDCHAT;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	/*case EVENT_CAMP_ELECTION:
	{
		if ((uint32_t)nLen >= sizeof(CampElectionEvent))
		{
			CampElectionEvent *pEvent = (CampElectionEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_CampSocial;
			param.parameter = PARAMETER_TYPE_CAMPSOCIAL_ELECTION;
			param.objectId = pEvent->type;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}*/
	/*case EVENT_CAMP_PRAYER:
	{
		if ((uint32_t)nLen >= sizeof(CampPrayerEvent))
		{
			CampPrayerEvent *pEvent = (CampPrayerEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_CampSocial;
			param.parameter = PARAMETER_TYPE_CAMPSOCIAL_PRAYER;
			param.objectId = pEvent->godId;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_ITEM_CHANGE:
	{
		if ((uint32_t)nLen >= sizeof(ItemChangeEvent))
		{
			ItemChangeEvent *pEvent = (ItemChangeEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			/*if (pEvent->changeType == S_USE_ITEM)
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_RecoverProperty;
				param.parameter = PARAMETER_TYPE_RECOVERPROPERTY_USEGOODS;
				param.objectId = pEvent->itemId;
				param.count = 1;
				UpdateAchievement(param);

				param.parameter = PARAMETER_TYPE_RECOVERPROPERTY_USEMEDICINE;
				UpdateAchievement(param);
			}
			if (pEvent->changeType == EItemOpetateType_Add)
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_RecoverProperty;
				param.parameter = PARAMETER_TYPE_RECOVERPROPERTY_FASHION;
				param.objectId = pEvent->itemId;
				param.count = 1;
				UpdateAchievement(param);
			}*/

			if (pEvent->opetateType == EItemOpetateType_Add && pEvent->changeType != S_ReBuy && pEvent->changeType != S_Storage)
			{
				const EquipEquipCfgInfo *pEquipCfg = g_GetEquipEquipCfgTable()->GetEquipEquipCfgInfo(pEvent->itemId);
				if (pEquipCfg && pEquipCfg->gold == 2)
				{
					AchievementParameterInfo param;
					param.type = Update_Type_Add;
					param.parameterType = EAEventType_Gather_Develop;
					param.parameter = PARAMETER_TYPE_GATHER_DEVELOP_TOP_WEAPON;
					param.count = pEvent->itemNum;
					UpdateAchievement(param);
				}
			}
		}
		break;
	}
	/*case EVENT_EQUP_STREN:
	{
		if ((uint32_t)nLen >= sizeof(EquipStrenEvent))
		{
			EquipStrenEvent *pEvent = (EquipStrenEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			if (pEvent->pos == EEquipPos_weapon || pEvent->pos == EEquipPos_clothes)
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Total;
				param.parameterType = EAEventType_Stren;
				param.parameter = (pEvent->pos == EEquipPos_weapon) ? PARAMETER_TYPE_STREN_WEAPON : PARAMETER_TYPE_STREN_ARMOUR;
				param.count = pEvent->strenLevel;
				UpdateAchievement(param);
			}
			if (pEvent->stoneNum > 0)
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_Stren;
				param.parameter = PARAMETER_TYPE_STREN_USESTONE;
				param.count = pEvent->stoneNum;
				UpdateAchievement(param);
			}
		}
		break;
	}*/
	case EVENT_EQUIP_REFINE:
	{
		if ((uint32_t)nLen >= sizeof(EquipRefineEvent))
		{
			EquipRefineEvent *pEvent = (EquipRefineEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Refine;
			param.parameter = PARAMETER_TYPE_REFINE_EQUIP;
			param.count = pEvent->refinLevel;
			UpdateAchievement(param);

			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Refine;
			param.parameter = PARAMETER_TYPE_REFINE_USESTONE;
			param.objectId = pEvent->stoneItemId;
			param.count = pEvent->stoneNum;
			UpdateAchievement(param);

			if (pEvent->costLuckyItem)
			{
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_Equip_Develop;
				param.parameter = PARAMETER_TYPE_EQUIP_DEVELOP_D;
				param.objectId = 180104010/*幸运卷轴id*/;
				param.count = 1;
				UpdateAchievement(param);
			}
			
		}
		break;
	}
	/*case EVENT_EQUP_STREN_ALL:
	{
		if ((uint32_t)nLen >= sizeof(StrenthAllEvent))
		{
			StrenthAllEvent *pEvent = (StrenthAllEvent*)(pContext);
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Stren;
			param.parameter = PARAMETER_TYPE_STREN_ALLEQUIP;
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_EQUIP_REFINE_ALL:
	{
		if ((uint32_t)nLen >= sizeof(RefineAllEvent))
		{
			RefineAllEvent *pEvent = (RefineAllEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Refine;
			param.parameter = PARAMETER_TYPE_REFINE_ALLEQUIP;
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_EQUIP_RECAST:
	{
		if ((uint32_t)nLen >= sizeof(EquipRecastEvent))
		{
			//EquipRecastEvent *pEvent = (EquipRecastEvent*)(pContext);
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Stren;
			param.parameter = PARAMETER_TYPE_STREN_RECASTEQUIP;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_COMPOSE:
	{
		if ((uint32_t)nLen >= sizeof(ComposeEvent))
		{
			ComposeEvent *pEvent = (ComposeEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			//param.parameterType = EAEventType_RecoverProperty;
			//param.parameter = PARAMETER_TYPE_RECOVERPROPERTY_COMPOSE;
			//param.objectId = pEvent->itemId;
			//param.count = pEvent->num;
			//UpdateAchievement(param);

			if (pEvent->type == 1/*宝石*/)
			{
				param.parameterType = EAEventType_Stone;
				param.parameter = PARAMETER_TYPE_STONE_COMPOSE;
				param.count = pEvent->num;
				UpdateAchievement(param);
			}
		}
		break;
	}
	case EVENT_STONE_INLAY:
	{
		if ((uint32_t)nLen >= sizeof(StoneInlayEvent))
		{
			StoneInlayEvent *pEvent = (StoneInlayEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Stone;
			param.parameter = PARAMETER_TYPE_STONE_INLAY;
			param.count = 1;
			UpdateAchievement(param);

			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Equip_Develop;
			param.parameter = PARAMETER_TYPE_EQUIP_DEVELOP_E;
			param.count = pEvent->stone_level;
			UpdateAchievement(param);

			param.parameter = PARAMETER_TYPE_EQUIP_DEVELOP_F;
			param.count = pEvent->ave_stone_level;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_CAMP_CHANGE:
	{
		if ((uint32_t)nLen >= sizeof(ChangeCampEvent))
		{
			ChangeCampEvent *pEvent = (ChangeCampEvent*)(pContext);
			if (nullptr == pEvent || pEvent->preCamp <= 0)	
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_CampSocial;
			param.parameter = PARAMETER_TYPE_CAMPSOCIAL_CHANGECAMP;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	/*case EVENT_DEPUTY_COLLECT_LEVEL_UP:
	{
		if ((uint32_t)nLen >= sizeof(CollectLevelUpEvent))
		{
			CollectLevelUpEvent *pEvent = (CollectLevelUpEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_NormalAvocation;
			switch (pEvent->type)
			{
			case ECollectDeputyType_Herbs:
				param.parameter = PARAMETER_TYPE_NORMALAVOCATION_MEDICINESKILL;
				break;
			case ECollectDeputyType_Mine:
				param.parameter = PARAMETER_TYPE_NORMALAVOCATION_MINESKILL;
				break;
			case ECollectDeputyType_Fish:
				param.parameter = PARAMETER_TYPE_NORMALAVOCATION_FISHSKILL;
				break;
			case ECollectDeputyType_Peel:
				param.parameter = PARAMETER_TYPE_NORMALAVOCATION_STRIPPESKILL;
				break;
			default:
				break;
			}
			param.count = pEvent->level;
			UpdateAchievement(param);
		}
		break;
	}
	break;*/
	/*case EVENT_DEPUTY_FORGE_LEVEL_UP:
	{
		if ((uint32_t)nLen >= sizeof(ForgeLevelUpEvent))
		{
			ForgeLevelUpEvent *pEvent = (ForgeLevelUpEvent*)(pContext);
			if (nullptr == pEvent)
				return;

			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_FactionSocial;
			param.parameter = PARAMETER_TYPE_FACTIONSOCIAL_SKILL;
			param.count = pEvent->level;
			UpdateAchievement(param);

			param.parameterType = EAEventType_MakeAvocation;
			switch (pEvent->type)
			{
			case EMakeDeputyType_Forge:
				param.parameter = PARAMETER_TYPE_MAKEAVOCATION_CAST;
				break;
			case EMakeDeputyType_Sew:
				param.parameter = PARAMETER_TYPE_MAKEAVOCATION_SEWING;
				break;
			case EMakeDeputyType_Smelt:
				param.parameter = PARAMETER_TYPE_MAKEAVOCATION_SMELT;
				break;
			case EMakeDeputyType_Cook:
				param.parameter = PARAMETER_TYPE_MAKEAVOCATION_COOK;
				break;
			case EMakeDeputyType_Medicine:
				param.parameter = PARAMETER_TYPE_MAKEAVOCATION_PHARMACY;
				break;
			default:
				break;
			}
			UpdateAchievement(param);
		}
		break;
	}*/
	/*case EVENT_DEPUTY_FORGE_EQUIP:
	{
		ForgeEquipEvent* pEvent = static_cast<ForgeEquipEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			if (pEvent->type == EMakeDeputyType_None)
			{
				param.type = Update_Type_Total;
				param.parameterType = EAEventType_SpecialAvocation;
				param.parameter = PARAMETER_TYPE_SPECIALAVOCATION_MEDICINE;
				param.objectId = pEvent->itemID;
				param.count = pEvent->count;
				UpdateAchievement(param);
			}
			else
			{
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_MakeAvocationItem;
				switch (pEvent->type)
				{
				case EMakeDeputyType_Forge:
					param.parameter = PARAMETER_TYPE_MAKEDEPUTY_CAST_ITEM_Parameter;
					break;
				case EMakeDeputyType_Sew:
					param.parameter = PARAMETER_TYPE_MAKEDEPUTY_SEWING_ITEM_Parameter;
					break;
				case EMakeDeputyType_Smelt:
					param.parameter = PARAMETER_TYPE_MAKEDEPUTY_SMELT_ITEM_Parameter;
					break;
				case EMakeDeputyType_Cook:
					param.parameter = PARAMETER_TYPE_MAKEDEPUTY_COOK_ITEM_Parameter;
					break;
				case EMakeDeputyType_Medicine:
					param.parameter = PARAMETER_TYPE_MAKEDEPUTY_PHARMACY_ITEM_Parameter;
					break;
				case EMakeDeputyType_Starsoul:
					param.parameter = PARAMETER_TYPE_MAKEDEPUTY_STARSOUL_ITEM_Parameter;
					break;
				default:
					break;
				}
				param.objectId = pEvent->itemID;
				param.count = pEvent->count;
				UpdateAchievement(param);
			}

			const EquipEquipCfgInfo *pEquip = g_GetEquipEquipCfgTable()->GetEquipEquipCfgInfo(pEvent->itemID);
			if (pEquip && pEquip->quality == EQuality_gold)
			{
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_SpecialAvocation;
				param.parameter = PARAMETER_TYPE_SPECIALAVOCATION_EQUIP;
				param.objectId = 0;
				param.count = pEvent->count;
				UpdateAchievement(param);
			}
		}
		break;
	}*/
	/*case EVENT_PET_FIGHT_POWER_CHANGE:
	{
		if ((uint32_t)nLen >= sizeof(PetFightPowerEvent))
		{
			PetFightPowerEvent *pEvent = (PetFightPowerEvent*)(pContext);
			if (pEvent)
			{
				AchievementParameterInfo param;
				param.type = Update_Type_Total;
				param.parameterType = EAEventType_Spirit;
				param.parameter = PARAMETER_TYPE_SPIRIT_FIGHT;
				param.count = pEvent->powerValue;
				UpdateAchievement(param);
			}
		}
		break;
	}
	case EVENT_ADD_PET:
	{
		addPetEvent* pEvent = static_cast<addPetEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Spirit;
			param.parameter = PARAMETER_TYPE_SPIRIT_GET;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_PET_FEED:
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_Spirit;
		param.parameter = PARAMETER_TYPE_SPIRIT_FEED;
		param.count = 1;
		UpdateAchievement(param);
		break;
	}*/
	/*case EVENT_PET_SKILL_UP:
	{
		petSkillUpgrade* pEvent = static_cast<petSkillUpgrade *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Spirit;
			param.parameter = PARAMETER_TYPE_SPECIALAVOCATION_MEDICINE;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
		}*/
	/*case EVENT_PET_UPGRADE_STAR:
	{
		petUpgradeLevel* pEvent = static_cast<petUpgradeLevel *>(pContext);
		if (pEvent && pEvent->star > 0)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Spirit;
			param.parameter = PARAMETER_TYPE_SPIRIT_LEVEL;
			param.count = pEvent->star;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_ANGER_CHANGE:
	{
		AngerChangeEvent* pEvent = static_cast<AngerChangeEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Socail;
			param.parameter = PARAMETER_TYPE_SOCIAL_EVIL;
			param.count = pEvent->curValue;
			UpdateAchievement(param);
		}
		break;
	}
	/*case EVENT_XINGZUO_TP:
	{
		breachUpgradeStar* pEvent = static_cast<breachUpgradeStar *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Player;
			param.parameter = PARAMETER_TYPE_PLAYER_CONSTELLATION;
			param.objectId = pEvent->curBreakLevel;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}*/
	case EVENT_GOD_LEVEL:
	{
		GodLevelEvent* pEvent = static_cast<GodLevelEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Gather_Develop;
			param.parameter = PARAMETER_TYPE_GATHER_DEVELOP_GOD_TOTAL_LEL;
			param.count = pEvent->totalLel;
			UpdateAchievement(param);

			param.parameter = PARAMETER_TYPE_GATHER_DEVELOP_GOD_LEL;
			param.count = pEvent->level;
			UpdateAchievement(param);

			/*AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Stren;
			param.parameter = PARAMETER_TYPE_GOD_COST;
			param.count = pEvent->count;
			UpdateAchievement(param);

			param.type = Update_Type_Total;
			param.parameter = PARAMETER_TYPE_GOD_LEVELUP;
			param.objectId = pEvent->godID;
			param.count = pEvent->level;
			UpdateAchievement(param);*/
		}
		break;
	}
	case EVENT_MONEY_CHANGE:
	{
		MoneyChangeEvent* pEvent = static_cast<MoneyChangeEvent *>(pContext);
		if (nullptr == pEvent)
			return;

		if (C_GOLD == pEvent->attrId)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Property;
			param.parameter = pEvent->value >= 0 ? PARAMETER_TYPE_PROPERTY_ADD_COIN : PARAMETER_TYPE_PROPERTY_SUB_COIN;
			param.count = abs(pEvent->value);
			UpdateAchievement(param);

			if (pEvent->source == S_TradeMail || pEvent->source == S_ACTUINEER)
			{
				param.type = Update_Type_Add;
				param.parameterType = EAEventType_Socail;
				param.parameter = pEvent->value >= 0 ? PARAMETER_TYPE_SOCIAL_ADDTRADINGCOIN : PARAMETER_TYPE_SOCIAL_DECTRADINGCOIN;
				param.count = abs(pEvent->value);
				UpdateAchievement(param);
			}
		}
		break;
	}
	case EVENT_FASHION_ACTIVE:
	{
		FashionActiveEvent* pEvent = static_cast<FashionActiveEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Gather_Develop;
			param.parameter = PARAMETER_TYPE_GATHER_DEVELOP_FASHION_ACTIVE;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_HORSE_ACTIVE:
	{
		HorseActiveEvent* pEvent = static_cast<HorseActiveEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			param.parameterType = EAEventType_Gather_Develop;
			param.parameter = PARAMETER_TYPE_GATHER_DEVELOP_RIDE_ACTIVE;
			param.count = 1;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_FINISH_RISK:
	{
		FinishRiskEvent* pEvent = static_cast<FinishRiskEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Add;
			if (pEvent->type == HYDT_MISSION_GUILD || pEvent->type == HYDT_MISSION_CAMP)
			{
				param.parameterType = EAEventType_Camp_Union;
				param.parameter = (pEvent->type == HYDT_MISSION_GUILD ? PARAMETER_TYPE_CAMP_UNION_UNION_SHILIAN : PARAMETER_TYPE_CAMP_UNION_UNION_MISSION);
				param.count = 1;
				UpdateAchievement(param);
			}
			else if (pEvent->type == HYDT_MISSION_BOUNTY)
			{
				param.parameterType = EAEventType_Nuolin_Risk;
				param.parameter = PARAMETER_TYPE_RL_RISK_SJ;
				param.count = 1;
				UpdateAchievement(param);
			}
		}
		break;
	}
	case EVENT_EQUIP_DRESS:
	{
		EquipDressEvent* pEvent = static_cast<EquipDressEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Equip_Develop;
			param.parameter = PARAMETER_TYPE_EQUIP_DEVELOP_A;
			param.count = pEvent->level;
			UpdateAchievement(param);

			param.parameter = PARAMETER_TYPE_EQUIP_DEVELOP_B;
			param.count = pEvent->quality;
			UpdateAchievement(param);

			param.parameter = PARAMETER_TYPE_EQUIP_DEVELOP_C;
			param.count = pEvent->hLevel;
			UpdateAchievement(param);
		}
		break;
	}
	case EVENT_UNION_RUN_BUSINESS:
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_Camp_Union;
		param.parameter = PARAMETER_TYPE_CAMP_UNION_UNION_TRADE;
		param.count = 1;
		UpdateAchievement(param);
		break;
	}
	case EVENT_UNION_HISTORY_CONTRI:
	{
		UnionHistoryContriEvent* pEvent = static_cast<UnionHistoryContriEvent *>(pContext);
		if (pEvent)
		{
			AchievementParameterInfo param;
			param.type = Update_Type_Total;
			param.parameterType = EAEventType_Camp_Union;
			param.parameter = PARAMETER_TYPE_CAMP_UNION_UNION_CONTRI;
			param.count = pEvent->value;
			UpdateAchievement(param);
		}
		break;
	}
	default:
		break;
	}
}

bool AchievementPart::OnMsgHandle(uint32_t cmd, const char* data, uint32_t len)
{
	switch (cmd)
	{
	case CLIENT_TO_SERVER_ACHIEVEMENTINFO:
	{
		HandleGetAchievementInfoReq(data, len);
		break;
	}
	case CLIENT_TO_SERVER_GETACHIEVEMENTREWARD:
	{
		HandleGetAchievementReward(data, len);
		break;
	}
	case CLIENT_TO_SERVER_GETACHIEVEMENTBOXREWARD:
	{
		HandleGetAchievementBoxReward(data, len);
		break;
	}
	default:
		break;
	}
	return true;
}

bool AchievementPart::HandleGetAchievementInfoReq(const char* data, uint32_t len)
{
	CGGetAchievementInfoReq req;

	if (!req.ParseFromArray(data, len))
	{
		MMOLOG_FMT_ERROR("[logic] CGGetAchievementInfoReq parse failed...");
		return false;
	}

	GCGetAchievementInfoRsp rsp;

	for (uint32_t i = ACHIEVEMENT_TYPE_PERSION; i < _achievementMap.size(); i++)
	{
		uint32_t totalProgress = 0; //成就总进度

		ClientAchievementSortInfo* pAchievementSortInfo = rsp.add_achievementlist();
		if (nullptr != pAchievementSortInfo)
		{
			//成就分类
			pAchievementSortInfo->set_sorttype(_achievementMap[i].sortType);

			for (std::map<uint32_t, AchievementInfo>::iterator iter = _achievementMap[i].achievementList.begin();
				iter != _achievementMap[i].achievementList.end(); ++iter)
			{
				ClientAchievementInfo* pAchievementInfo = pAchievementSortInfo->add_achievementinfolist();
				if (nullptr != pAchievementInfo)
				{
					pAchievementInfo->set_id(iter->first);
					pAchievementInfo->set_completecount(iter->second.completeCount);
					pAchievementInfo->set_status(iter->second.status);
					if (iter->second.status == ACHIEVEMENT_STATUS_REWARD)
					{
						const AchievementAchievementCfgInfo* pAchievementCfgInfo = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(iter->first);
						if (nullptr != pAchievementCfgInfo)
						{
							totalProgress += pAchievementCfgInfo->achievementPoint;
						}
					}
				}				
			}

			pAchievementSortInfo->set_achievementprogress(totalProgress);
			pAchievementSortInfo->set_achievementreward(_achievementMap[i].achievementReward);
		}
		
	}

	m_pMaster->SendDataToClient(EMODULE_ID_ACHIEVEMENT, SERVER_TO_CLIENT_ACHIEVEMENTINFO, &rsp);

	return true;
}

bool AchievementPart::HandleGetAchievementReward(const char* data, uint32_t len)
{
	CGGetAchievementRewardReq req;

	if (!req.ParseFromArray(data, len))
	{
		MMOLOG_FMT_ERROR("[logic] CGGetAchievementRewardReq parse failed...");
		return false;
	}

	GCGetAchievementRewardRsp rsp;

	uint32_t sortType = req.sorttype();
	uint32_t achievementId = req.achievementid();

	ERetCode ret = GetAchievementReward(sortType, achievementId);
	rsp.set_ret(ret);
	rsp.set_sorttype(sortType);
	rsp.set_achievementid(achievementId);
	m_pMaster->SendDataToClient(EMODULE_ID_ACHIEVEMENT, SERVER_TO_CLIENT_GETACHIEVEMENTREWARD, &rsp);

	return true;
}

bool AchievementPart::HandleGetAchievementBoxReward(const char* data, uint32_t len)
{
	CGGetAchievementBoxRewardReq req;

	if (!req.ParseFromArray(data, len))
	{
		MMOLOG_FMT_ERROR("[logic] CGGetAchievementBoxRewardReq parse failed...");
		return false;
	}

	CGGetAchievementBoxRewardRsp rsp;

	uint32_t prizeId = req.prizeid();

	ERetCode ret = GetAchievementBoxReward(prizeId);

	rsp.set_prizeid(prizeId);
	rsp.set_ret(ret);
	m_pMaster->SendDataToClient(EMODULE_ID_ACHIEVEMENT, SERVER_TO_CLIENT_GETACHIEVEMENTBOXREWARD, &rsp);

	return true;
}

ERetCode AchievementPart::GetAchievementReward(uint32_t sortType, uint32_t achievementId)
{
	if (sortType < ACHIEVEMENT_TYPE_PERSION || sortType >= ACHIEVEMENT_TYPE_NUM)
	{
		return RET_ACHIEVEMENT_SORTTYEP_ERROR;
	}

	const AchievementAchievementCfgInfo* pAchievementCfgInfo = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(achievementId);
	if (nullptr == pAchievementCfgInfo)
	{
		return RET_ACHIEVEMENT_NOT_EXIST;
	}

	std::map<uint32_t, AchievementInfo>::iterator iter = _achievementMap[sortType].achievementList.find(achievementId);
	if (iter == _achievementMap[sortType].achievementList.end())
	{
		return RET_ACHIEVEMENT_NOT_EXIST;
	}

	if (iter->second.status == ACHIEVEMENT_STATUS_REWARD)
	{
		return RET_ACHIEVEMENT_REWARD_HAVE_GET;
	}

	LIST_ITEM adddItems;
	for (uint32_t i = 0; i < pAchievementCfgInfo->vecAchievementAchievementItemRewardCfg.size(); i++)
	{
		if (pAchievementCfgInfo->vecAchievementAchievementItemRewardCfg[i].ID > 0 && pAchievementCfgInfo->vecAchievementAchievementItemRewardCfg[i].Value > 0)
		{
			SItem item;
			item.nItemID = pAchievementCfgInfo->vecAchievementAchievementItemRewardCfg[i].ID;
			item.nNum = pAchievementCfgInfo->vecAchievementAchievementItemRewardCfg[i].Value;
			adddItems.push_back(item);
		}
	}

	Player *pPlayer = dynamic_cast<Player*>(m_pMaster);
	if (nullptr == pPlayer)
	{
		return RET_FAIL;
	}

	Part* pIpackage = m_pMaster->GetPart(PART_PACKAGE);
	if (nullptr != pIpackage)
	{
		SItemSourceParam sourceParam;
		sourceParam.source = S_ACHIEVEMENT;
		if (!pIpackage->AddItem(adddItems, sourceParam))
		{
			return RET_PACKAGE_SPACE_NOT_ENOUGH;
		}
	}

	iter->second.status = ACHIEVEMENT_STATUS_REWARD;

	//金币
	if (pAchievementCfgInfo->achievementGold > 0)
	{
		//m_pMaster->AddAttr(C_GOLD, (int64_t)pAchievementCfgInfo->achievementGold, true);
		m_pMaster->AddSourceAttr(C_GOLD, (int64_t)pAchievementCfgInfo->achievementGold, true, S_ACHIEVEMENT);
	}

	//绑定钻石
	if (pAchievementCfgInfo->achievementDia > 0)
	{
		//m_pMaster->AddAttr(C_DIAMOND_BIND, pAchievementCfgInfo->achievementDia, true);
		pPlayer->AddSourceAttr(C_DIAMOND_BIND, pAchievementCfgInfo->achievementDia, true, S_ACHIEVEMENT);
	}

	//钻石
	if (pAchievementCfgInfo->achievementJewel > 0)
	{
		pPlayer->AddSourceAttr(C_DIAMOND, pAchievementCfgInfo->achievementJewel, true, S_ACHIEVEMENT);
	}

	//经验
	if (pAchievementCfgInfo->achievementEXP > 0)
	{
		pPlayer->AddExp(pAchievementCfgInfo->achievementEXP);
	}

	//获取当前总点数
	uint32_t totalPointValue = 0;
	for (std::map<uint32_t, AchievementInfo>::iterator iter = _achievementMap[sortType].achievementList.begin();
		iter != _achievementMap[sortType].achievementList.end(); ++iter)
	{
		if (iter->second.status == ACHIEVEMENT_STATUS_REWARD)
		{
			const AchievementAchievementCfgInfo* pAchievementCfgInfo = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(iter->first);
			if (nullptr != pAchievementCfgInfo)
			{
				totalPointValue += pAchievementCfgInfo->achievementPoint;
			}
		}
	}

	//通知中心服排行版成就积分
	if (totalPointValue > 0)
	{
		LogicToCenterRankingListAchievement req;
		req.set_charid(m_pMaster->GetCid());
		AchievementPointInfo* pointInfo = req.mutable_changeachievement();
		pointInfo->set_id(achievementId);
		pointInfo->set_type(sortType);
		pointInfo->set_point(totalPointValue);
		g_GetLogicService()->SendDataToCenter(EMODULE_ID_RANKINGLIST, LOGIC_CENTER_UPDATe_RANKING_LIST_ACHIEVEMENT, &req);
	}

	//领取的时候才完成称号
	AchevimentFinishEvent finishEevent;
	finishEevent.achevimentID = achievementId;
	g_GetEvent()->FireExecute(EVENT_FINISH_ACHIVEMENT, m_pMaster->GetCid(), CREATURE_PLAYER, &finishEevent, sizeof(AchevimentFinishEvent));

	return RET_SUCCESS;
}

ERetCode AchievementPart::GetAchievementBoxReward(uint32_t prizeId)
{
	const AchievementAchievementrewardCfgInfo* pAchievementRewardCfgInfo = g_GetAchievementAchievementrewardCfgTable()->GetAchievementAchievementrewardCfgInfo(prizeId);
	if (nullptr == pAchievementRewardCfgInfo)
	{
		return RET_ACHIEVEMENT_BOX_REWARD_ERROR;
	}

	uint32_t sortType = pAchievementRewardCfgInfo->achievementType;
	if (sortType < ACHIEVEMENT_TYPE_PERSION || sortType >= ACHIEVEMENT_TYPE_NUM)
	{
		return RET_ACHIEVEMENT_SORTTYEP_ERROR;
	}

	uint32_t totalPointValue = 0;
	uint32_t achievementPointValue = pAchievementRewardCfgInfo->achievementPointValue;
	for (std::map<uint32_t, AchievementInfo>::iterator iter = _achievementMap[sortType].achievementList.begin();
		iter != _achievementMap[sortType].achievementList.end(); ++iter)
	{
		if (iter->second.status >= ACHIEVEMENT_STATUS_NOT_REWARD)
		{
			const AchievementAchievementCfgInfo* pAchievementCfgInfo = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(iter->first);
			if (nullptr != pAchievementCfgInfo)
			{
				totalPointValue += pAchievementCfgInfo->achievementPoint;
			}
		}		
	}

	if (totalPointValue < achievementPointValue)
	{
		return RET_ACHIEVEMENT_BOX_REWARD_POINT_LIMIT;
	}

	/*int32_t index = g_GetAchievementMgr()->GetAchievementBoxIndex(sortType, totalPointValue);
	if (index < 0)
	{
		return RET_ACHIEVEMENT_BOX_REWARD_POINT_LIMIT;
	}*/
	int32_t index = prizeId % 100;
	if (index < 1)
	{
		return RET_ACHIEVEMENT_BOX_REWARD_POINT_LIMIT;
	}

	if ((_achievementMap[sortType].achievementReward >> (index -1)) & 0x00000001)
	{
		return RET_ACHIEVEMENT_BOX_REWARD_HAVE_GET;
	}

	LIST_ITEM adddItems;
	for (uint32_t i = 0; i < pAchievementRewardCfgInfo->vecAchievementAchievementrewardRewardCfg.size(); i++)
	{
		if (pAchievementRewardCfgInfo->vecAchievementAchievementrewardRewardCfg[i].ID > 0 && pAchievementRewardCfgInfo->vecAchievementAchievementrewardRewardCfg[i].Value > 0)
		{
			SItem item;
			item.nItemID = pAchievementRewardCfgInfo->vecAchievementAchievementrewardRewardCfg[i].ID;
			item.nNum = pAchievementRewardCfgInfo->vecAchievementAchievementrewardRewardCfg[i].Value;
			adddItems.push_back(item);
		}	
	}

	Part* pIpackage = m_pMaster->GetPart(PART_PACKAGE);
	if (nullptr != pIpackage)
	{
		SItemSourceParam sourceParam;
		sourceParam.source = S_ACHIEVEMENT;
		if (!pIpackage->AddItem(adddItems, sourceParam))
		{
			return RET_PACKAGE_SPACE_NOT_ENOUGH;
		}
	}

	_achievementMap[sortType].achievementReward = _achievementMap[sortType].achievementReward | (0x00000001 << (index-1));

	return RET_SUCCESS;
}

void AchievementPart::UpdateAchievement(AchievementParameterInfo& achievementParameter)
{
	//如果等于0直接返回
	if (0 == achievementParameter.count)
	{
		return;
	}

	GCAchievementNotify acNotify;
	UpdateAchievement(achievementParameter, acNotify);

	//存在改变的成就发送消息
	if (acNotify.changeachievementlist_size() > 0)
	{
		m_pMaster->SendDataToClient(EMODULE_ID_ACHIEVEMENT, SERVER_TO_CLIENT_ACHIEVENTMENTNOTIFY, &acNotify);
	}
}

bool AchievementPart::UpdateAchievement(AchievementParameterInfo& achievementParameter, GCAchievementNotify& acNotify)
{
	//获取成就的ID
	VEC_UINT32* achievementIdVec = g_GetAchievementMgr()->GetAchievementIdVec(achievementParameter);
	if (achievementIdVec == nullptr)
	{
		//MMOLOG_FMT_ERROR("[logic] AchievementPart::UpdateAchievement but achievementIdVec is nullptr parameterType=%u, parameter=%u", achievementParameter.parameterType, achievementParameter.parameter);
		return false;
	}

	//获取成就大类信息
	for (uint32_t i = 0; i < achievementIdVec->size(); i++)
	{
		uint32_t achievementId = achievementIdVec->at(i);

		//获取该成就的信息
		const AchievementAchievementCfgInfo* pAchievementCfgInfo = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(achievementId);
		if (nullptr == pAchievementCfgInfo)
		{
			MMOLOG_FMT_ERROR("[logic] AchievementPart::UpdateAchievement but pAchievementCfgInfo is nullptr, achievementId=%u", achievementId);
			return false;
		}

		//检查成就大类型是否正确
		uint32_t sortType = pAchievementCfgInfo->achievementType;
		if (sortType < ACHIEVEMENT_TYPE_PERSION || sortType >= ACHIEVEMENT_TYPE_NUM)
		{
			MMOLOG_FMT_ERROR("[logic] AchievementPart::UpdateAchievement but pAchievementCfgInfo achievementType is error, achievementType=%u", pAchievementCfgInfo->achievementType);
			return false;
		}

		AchievementPlayerSortInfo& playerSortInfo = _achievementMap[sortType];
		std::map<uint32_t, AchievementInfo>::iterator iter = playerSortInfo.achievementList.find(achievementId);
		//如果找到
		if (iter != playerSortInfo.achievementList.end())
		{
			//当存在成就信息并且没有完成
			if (iter->second.status <= ACHIEVEMENT_STATUS_NOT_COMPLETE)
			{
				//判断目标ID是否一致 如果有目标限制 那么需要判断目标是否一致
				if (pAchievementCfgInfo->achievementObjectID != 0)
				{
					if (achievementParameter.objectId != (uint32_t)pAchievementCfgInfo->achievementObjectID)
					{
						continue;
					}
				}

				if (!CheckAchieve(iter->second, achievementParameter, pAchievementCfgInfo))
				{
					continue;
				}
				//CheckAchieve(iter->second, achievementParameter, pAchievementCfgInfo);

				//填充信息给客户端
				ClientAchievementInfo* pAchievementInfo = acNotify.add_changeachievementlist();
				pAchievementInfo->set_id(achievementId);
				pAchievementInfo->set_completecount(iter->second.completeCount);
				pAchievementInfo->set_status(iter->second.status);
				pAchievementInfo->set_type(sortType);
			}
		}
		//如果不存在
		else
		{
			//判断目标ID是否一致 如果有目标限制 那么需要判断目标是否一致
			if (pAchievementCfgInfo->achievementObjectID != 0)
			{
				if (achievementParameter.objectId != (uint32_t)pAchievementCfgInfo->achievementObjectID)
				{
					continue;
				}
			}

			AchievementInfo achievementInfo;
			achievementInfo.status = ACHIEVEMENT_STATUS_NOT_COMPLETE;

			if (!CheckAchieve(achievementInfo, achievementParameter, pAchievementCfgInfo))
			{
				continue;
			}
			//CheckAchieve(achievementInfo, achievementParameter, pAchievementCfgInfo);

			playerSortInfo.achievementList[achievementId] = achievementInfo;

			//填充信息给客户端
			ClientAchievementInfo* pAchievementInfo = acNotify.add_changeachievementlist();
			pAchievementInfo->set_id(achievementId);
			pAchievementInfo->set_completecount(achievementInfo.completeCount);
			pAchievementInfo->set_status(achievementInfo.status);
			pAchievementInfo->set_type(sortType);
		}

	}

	return true;
}

//是否已经完成
bool AchievementPart::FinishAchieve(uint32_t achieveId)
{
	const AchievementAchievementCfgInfo *pcfg = g_GetAchievementAchievementCfgTable()->GetAchievementAchievementCfgInfo(achieveId);
	return FinishAchieve(pcfg);
}

bool AchievementPart::FinishAchieve(const AchievementAchievementCfgInfo *pcfg)
{
	if (nullptr == pcfg)
	{
		return false;
	}
	uint32_t sortType = pcfg->achievementType;
	if (sortType < ACHIEVEMENT_TYPE_PERSION || sortType >= ACHIEVEMENT_TYPE_NUM)
	{
		LogErrFmtPrint("[logic] AchievementPart::AcceptAchieve but pcfg achievementType is error, achievementType=%u", pcfg->achievementType);
		return false;
	}
	AchievementPlayerSortInfo& playerSortInfo = _achievementMap[sortType];
	std::map<uint32_t, AchievementInfo>::iterator iter = playerSortInfo.achievementList.find(pcfg->achievementId);
	if (iter != playerSortInfo.achievementList.end())
	{
		if (iter->second.status >= ACHIEVEMENT_STATUS_NOT_REWARD)
		{
			return true;
		}
	}
	return false;
}

//检查成就
bool AchievementPart::CheckAchieve(AchievementInfo &achievementInfo, AchievementParameterInfo& achievementParameter, const AchievementAchievementCfgInfo* pAchievementCfgInfo)
{
	bool change = true;
	if (Update_Type_Add == achievementParameter.type) //进行累加
	{
		achievementInfo.completeCount += achievementParameter.count;
	}
	else if (Update_Type_Total == achievementParameter.type)
	{
		if (achievementInfo.completeCount < achievementParameter.count)
			achievementInfo.completeCount = achievementParameter.count;
		else
			change = false;
	}
	else if (Update_Type_Dec == achievementParameter.type)
	{
		//achievementInfo.completeCount = (achievementInfo.completeCount <= 0) ? achievementParameter.count : (achievementInfo.completeCount > achievementParameter.count ? achievementParameter.count : achievementInfo.completeCount);
		if (achievementInfo.completeCount <= 0)
			achievementInfo.completeCount = achievementParameter.count;
		else if (achievementInfo.completeCount > achievementParameter.count)
			achievementInfo.completeCount = achievementParameter.count;
		else
		{
			achievementInfo.completeCount = achievementInfo.completeCount;
			change = false;
		}
	}

	if (!change)	return change;

	//判断减少则达成
	if (Update_Type_Dec == achievementParameter.type && achievementInfo.completeCount <= (uint32_t)pAchievementCfgInfo->achievementObjectValue)
	{
		achievementInfo.completeCount = pAchievementCfgInfo->achievementObjectValue;
		achievementInfo.status = ACHIEVEMENT_STATUS_NOT_REWARD;
	}

	//判断增加则达成
	if (Update_Type_Dec != achievementParameter.type && achievementInfo.completeCount >= (uint32_t)pAchievementCfgInfo->achievementObjectValue)
	{
		achievementInfo.completeCount = pAchievementCfgInfo->achievementObjectValue;
		achievementInfo.status = ACHIEVEMENT_STATUS_NOT_REWARD;
	}

	AchevimentProgressAddEvent progressEvent;
	progressEvent.achevimentID = pAchievementCfgInfo->achievementId;
	progressEvent.curProgress = achievementInfo.completeCount;
	g_GetEvent()->FireExecute(EVENT_ADD_ACHIVEMENT_PROGRESS, m_pMaster->GetCid(), m_pMaster->CreatureKind(), &progressEvent, sizeof(AchevimentProgressAddEvent));

	return change;
}

void AchievementPart::DoAttrChange(uint32_t PANum, int64_t nCurValue, int64_t nChangeValue)
{
	//uint64_t curTick = Time::Now().UnixNano();
	//LogDebugFmtPrint("+++++++++++++++DoAttrChange++++++++++++++++%lu", Time::Now().UnixNano() - curTick);
	if (P_FIGHT_POWER == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_Property;
		param.parameter = PARAMETER_TYPE_PROPERTY_FIGHT;
		param.count = nCurValue;
		UpdateAchievement(param);
	}
	else if (P_AP == PANum || P_MAT == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_Property;
		param.parameter = PARAMETER_TYPE_PROPERTY_ATTACH;
		param.count = nCurValue;
		UpdateAchievement(param);
	}
	else if (P_DP == PANum || P_MDP == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_Property;
		param.parameter = PARAMETER_TYPE_PROPERTY_DEFENSE;
		param.count = nCurValue;
		UpdateAchievement(param);
	}
	else if (P_HP == PANum || P_MAX_HP == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_Property;
		param.parameter = PARAMETER_TYPE_PROPERTY_LIFE;
		param.count = nCurValue;
		UpdateAchievement(param);

		/*if (P_MAX_HP == PANum)	return;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_RecoverProperty;
		param.parameter = PARAMETER_TYPE_RECOVERPROPERTY_LIFE;
		if (nChangeValue > 0)
		{
			param.count = nChangeValue;
			UpdateAchievement(param);
		}*/
	}
	/*else if (P_MP == PANum)
	{
		if (nChangeValue <= 0)	return;
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_RecoverProperty;
		param.parameter = PARAMETER_TYPE_RECOVERPROPERTY_MAGIC;
		param.count = nChangeValue;
		UpdateAchievement(param);
	}*/
	/*else if (P_GOLD == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_Property;
		param.parameter = nChangeValue >= 0 ? PARAMETER_TYPE_PROPERTY_ADD_COIN : PARAMETER_TYPE_PROPERTY_SUB_COIN;
		param.count = abs(nChangeValue);
		UpdateAchievement(param);
	}*/
	/*else if (P_UNION_CONTRI == PANum)
	{
		if (nChangeValue <= 0)	return;
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_FactionSocial;
		param.parameter = PARAMETER_TYPE_FACTIONSOCIAL_ADDCONTRIBUTION;
		param.count = nChangeValue;
		UpdateAchievement(param);
	}*/
	else if (P_CAMP_SCORE == PANum)
	{
		if (nChangeValue <= 0)	return;
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_CampSocial;
		param.parameter = PARAMETER_TYPE_CAMPSOCIAL_ADDCONTRIBUTION;
		param.count = nChangeValue;
		UpdateAchievement(param);
	}
	else if (P_CAMP_KILLERS == PANum)
	{
		if (nChangeValue <= 0)	return;
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_CampSocial;
		param.parameter = PARAMETER_TYPE_CAMPSOCIAL_ADDINTEGRAL;
		param.count = nChangeValue;
		UpdateAchievement(param);

		param.parameter = PARAMETER_TYPE_CAMPSOCIAL_KILLENEMY;
		UpdateAchievement(param);
	}
	else if (P_KNIGHT == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_CampSocial;
		param.parameter = PARAMETER_TYPE_CAMPSOCIAL_PEERAGE;
		param.objectId = nCurValue;
		param.count = 1;
		UpdateAchievement(param);
	}
	/*else if (P_OFFICIAL == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_CampSocial;
		param.parameter = PARAMETER_TYPE_CAMPSOCIAL_OFFCIAL;
		param.objectId = nCurValue;
		param.count = 1;
		UpdateAchievement(param);
	}*/
	else if (P_UNION_LEVEL == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Total;
		param.parameterType = EAEventType_Camp_Union;
		param.parameter = PARAMETER_TYPE_CAMP_UNION_UNION_LEL;
		param.count = nCurValue;
		UpdateAchievement(param);
	}
	else if (P_CAMP_PRESTIGE == PANum)
	{
		AchievementParameterInfo param;
		param.type = Update_Type_Add;
		param.parameterType = EAEventType_Camp_Union;
		param.parameter = PARAMETER_TYPE_CAMP_UNION_PRESTIGE;
		param.count = nChangeValue;
		UpdateAchievement(param);
	}
	//LogDebugFmtPrint("+++++++++++++++DoAttrChange++++++++++++++++%lu", Time::Now().UnixNano() - curTick);
}
